"""
额度查询
调用此方法输入身份证号码查询客户额度状态
"""

import requests
from common import public_login


def base_req_text(ids):
    base_url = 'http://plsadmpre.cnsuning.com/plsadm/quota/customerCreditQuery/queryCustomerCreditByIds.do'
    r = requests.post(url=base_url, data={'ids': ids}, headers={'cookie': public_login.gl_cookie()})
    result = r.text
    assert isinstance(result, object)
    res = result
    if '不存在' in res:
        print('该用户，不存在额度')
    else:
        if '激活成功' in res:
            if '有效' in res:
                print('该用户，已激活，存在有效额度')
            elif '冻结' in res:
                print('该用户，已激活，额度冻结中')
            else:
                print('该用户，不存在有效额度')
        elif '未激活' in res:
            print('该用户，额度未激活')
        elif '激活中' in res:
            print('该用户，额度激活中')
        else:
            print('该用户，激活失败')

    return result


if __name__ == '__main__':
    base_req_text(ids='310101199104017540')
